﻿using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;

namespace SlamDunk.MES.DataDrive.Client.Converters
{
    /// <summary>
    /// 整形为零时转换器
    /// </summary>
    public class IntZeroToVisibilityConveter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            Visibility resultVisibility = Visibility.Collapsed;
            if (value != null)
            {
                if (int.Parse(value.ToString()) != 0)
                {
                    resultVisibility = Visibility.Visible;
                }
            }
            return resultVisibility;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
